﻿<UserControl x:Class="PokemonBattleOnline.PBO.Editor.PokemonIcon"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ui="clr-namespace:PokemonBattleOnline.PBO.Elements"
             xmlns:c="clr-namespace:PokemonBattleOnline.PBO.Converters"
             xmlns:e="clr-namespace:PokemonBattleOnline.PBO.Editor"
             Cursor="Hand" AllowDrop="True" Height="32" Width="32">
    <UserControl.ContextMenu>
        <ContextMenu>
            <MenuItem Name="Copy" Click="Copy_Click" Header="复制"/>
            <MenuItem Name="CopyAll" Click="CopyAll_Click" Header="全队复制"/>
            <MenuItem Name="Paste" Click="Paste_Click" Header="粘贴"/>
            <Separator/>
            <MenuItem Name="Remove" Click="Remove_Click" Header="删除"/>
        </ContextMenu>
    </UserControl.ContextMenu>
    <Canvas>
        <Polygon Name="Stroke" Points="1.5,16 6.5,4.5 25.5,4.5 30.5,16 25.5,27.5 6.5,27.5">
            <Polygon.Style>
                <Style TargetType="Polygon">
                    <Setter Property="Stroke" Value="{x:Null}"/>
                    <Setter Property="StrokeThickness" Value="0"/>
                    <Setter Property="Fill" Value="Transparent"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsRare}" Value="True">
                            <Setter Property="Fill" Value="#80ff0000"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding IsEditing}" Value="True">
                            <Setter Property="Stroke" Value="#80ffffff"/>
                            <Setter Property="StrokeThickness" Value="3"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding IsDragging}" Value="True">
                            <Setter Property="Stroke" Value="{x:Static ui:SBrushes.BlueM}"/>
                            <Setter Property="StrokeThickness" Value="3"/>
                            <Setter Property="Fill" Value="Transparent"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding DropState}" Value="1">
                            <Setter Property="Stroke" Value="{x:Static ui:SBrushes.BlueM}"/>
                            <Setter Property="StrokeThickness" Value="3"/>
                            <Setter Property="Fill" Value="Transparent"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding DropState}" Value="2">
                            <Setter Property="Stroke" Value="{x:Static ui:SBrushes.MagentaM}"/>
                            <Setter Property="StrokeThickness" Value="3"/>
                            <Setter Property="Fill" Value="Transparent"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Polygon.Style>
        </Polygon>
        <Image Name="icon" IsHitTestVisible="False" Height="30" Width="40" Canvas.Left="-4" Canvas.Bottom="0">
            <Image.ToolTip>
                <ToolTip Content="{Binding Model}">
                    <ToolTip.ContentTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <TextBlock Text="{Binding Name}" FontWeight="Bold"/>
                                <TextBlock Text="{Binding Moves[0].Move.Id, Converter={x:Static c:MoveString.C}}"/>
                                <TextBlock Text="{Binding Moves[1].Move.Id, Converter={x:Static c:MoveString.C}}"/>
                                <TextBlock Text="{Binding Moves[2].Move.Id, Converter={x:Static c:MoveString.C}}"/>
                                <TextBlock Text="{Binding Moves[3].Move.Id, Converter={x:Static c:MoveString.C}}"/>
                            </StackPanel>
                        </DataTemplate>
                    </ToolTip.ContentTemplate>
                </ToolTip>
            </Image.ToolTip>
            <Image.Style>
                <Style TargetType="Image">
                    <Setter Property="Source" Value="{Binding Icon}"/>
                </Style>
            </Image.Style>
        </Image>
    </Canvas>
</UserControl>
